<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 获取当前时间 -->
    <script>
        var a =new Date();
        var year = a.getFullYear();//年
        var month = a.getMonth();//月
        var day = a.getDay();//日
        var hours = a.getHours();//时
        var minutes = a.getMinutes();//分
        var seconds = a.getSeconds();//秒
        var mills = a.getTime();//毫秒
        console.log(a);
        console.log(year);
        console.log(month+1); //注意这里月份要加一
        console.log(day);
        console.log(hours);
        console.log(minutes);
        console.log(seconds);
        console.log(mills);
    </script>
</body>
</html>